# $Id: PKGBUILD 88760 2013-04-22 09:40:37Z tpowa $
# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>

pkgname=r8168-lts
_pkgname=r8168
pkgver=8.035.00
pkgrel=3
pkgdesc="A kernel module for Realtek 8168 network cards for linux-lts"
url="http://www.realtek.com.tw"
license=("GPL")
arch=('i686' 'x86_64')
depends=('glibc' "linux-lts>=3.0" "linux-lts<3.1")
makedepends=("linux-lts-headers>=3.0" "linux-lts-headers<3.1")
source=(http://r8168.googlecode.com/files/$_pkgname-$pkgver.tar.bz2)
install=$pkgname.install

_extramodules=extramodules-3.0-lts

build() {
	cd "$_pkgname-$pkgver"
	local _kernver="$(cat /usr/lib/modules/$_extramodules/version)"
	make -C /usr/lib/modules/$_kernver/build \
			SUBDIRS="$srcdir/$_pkgname-$pkgver/src" \
			EXTRA_CFLAGS="-DCONFIG_R8168_NAPI -DCONFIG_R8168_VLAN" \
			modules
}

package() {
	cd "$_pkgname-$pkgver"
	install -Dm644 src/$_pkgname.ko "$pkgdir/usr/lib/modules/$_extramodules/$_pkgname.ko"
	find "$pkgdir" -name '*.ko' -exec gzip -9 {} +
}

sha256sums=('b904d31fc9bd6c97cc34479a0eba0e3a9bba5351a43b56dd5fff6b7dc1a5df73')
